<script setup>
import { ref } from 'vue';

const text = ref('')
const checkValue = ref(false)
const checkedNames = ref([])

const selected = ref('A')

const options = ref([
  { text: 'One', value: 'A' },
  { text: 'Two', value: 'B' },
  { text: 'Three', value: 'C' }
])

const toggle = ref('yes')

const msg = ref('')

const age = ref(0)

</script>
<template>
    <h1>Vue model</h1>    

    {{ age }}
    <input name="age" v-model.number="age" />

    <br>
    {{ msg }}
    <input name="msg" v-model.lazy="msg" />
    <br>
    <input v-model.trim="msg" />

    <br>
    {{ toggle }}
    <input name="toggle"
        type="checkbox"
        v-model="toggle"
        true-value="yes"
        false-value="no" />

    <div>Selected: {{ selected }}</div> 
    <select name="option" v-model="selected">
        <option v-for="option in options" :value="option.value">
            {{ option.text }}
        </option>
    </select>

    <div>Selected: {{ selected }}</div>
        <select name="option" v-model="selected">
            <option disabled value="">Please select one</option>
            <option>A</option>
            <option>B</option>
            <option>C</option>
        </select>


    <div>Checked names: {{ checkedNames }}</div>
    <input type="checkbox" id="jack" value="Jack" v-model="checkedNames" />
    <label for="jack">Jack</label>

    <input type="checkbox" id="john" value="John" v-model="checkedNames" />
    <label for="john">John</label>

    <input type="checkbox" id="mike" value="Mike" v-model="checkedNames" />
    <label for="mike">Mike</label>

    <br>
    {{ checkValue }} <br>
    <input name="checkbox" type="checkbox" v-model="checkValue">

    <br>
    text:{{ text }} <br>
    <input name="tetx" type="text" v-model="text"> <br> 
    <textarea name="text" v-model="text"></textarea>
</template>
<style scoped>
</style>